let letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//document.writeln(letters.length);

let rot13 = function (str,offset=13) { // LBH QVQ VG!
    return str.split('').map(function (ch) {
        return letters.indexOf(ch) < 0 ? ch : letters[(letters.indexOf(ch) +offset) % 26];
    }).join('');
};

console.log(rot13("I LOVE YOU"));


let message='P SVCL FVB';

for(let offset=1;offset<26;++offset){
    console.log(offset+" "+rot13(message,offset));
}
